<div id="page-wrapper">
	<div class="row">
		<div class="col-lg-12">
			<h3 class="page-header"><?= $title?></h3>
		</div>
		<!-- /.col-lg-12 -->
	</div>
	<!-- /.row -->
	<div class="row">
		<div class="col-lg-12">
			<?php 
			if($form):
			?>
			<form class="form-horizontal" method="post" action="">
				<fieldset>

				<!-- Text input-->
				<div class="form-group <?= $style ?>">
					<label class="col-md-4 control-label" for="data[NIMHSMSMHS]">NIM MHS</label>  
					<div class="col-md-5">
					<input id="NIMHSMSMHS" name="NIMHSMSMHS" type="text" placeholder="NIM MHS" class="form-control input-md" value="<?=  $v=(isset($value))? $value['NIMHSMSMHS'] : $validasi->value('NIMHSMSMHS');?>" >
					<?= $validasi->errorMessages('NIMHSMSMHS', '<span class="help-block">', '</span>');?>
					</div>
				</div>

				<!-- Text input-->
				<div class="form-group <?= $style ?>">
					<label class="col-md-4 control-label" for="NMMHSMSMHS">NAMA MHS</label>  
					<div class="col-md-5">
					<input id="NMMHSMSMHS" name="NMMHSMSMHS" type="text" placeholder="NAMA MHS" class="form-control input-md" value="<?= $v=(isset($value))? $value['NMMHSMSMHS'] : $validasi->value('NMMHSMSMHS');?>" >
					<?= $validasi->errorMessages('NMMHSMSMHS', '<span class="help-block">', '</span>');?>
					</div>
				</div>

				<!-- Text input-->
				<div class="form-group <?= $style ?>">
					<label class="col-md-4 control-label" for="TPLHRMSMHS">TMPT LAHIR</label>  
					<div class="col-md-5">
					<input id="TPLHRMSMHS" name="TPLHRMSMHS" type="text" placeholder="TMPT LAHIR" class="form-control input-md" value="<?= $v=(isset($value))? $value['TPLHRMSMHS'] : $validasi->value('TPLHRMSMHS');?>" >
					<?= $validasi->errorMessages('TPLHRMSMHS', '<span class="help-block">', '</span>');?>
					</div>
				</div>
				<!-- Text input-->
				<div class="form-group <?= $style ?>">
					<label class="col-md-4 control-label" for="TGLHRMSMHS">TGL LAHIR</label>  
					<div class="col-md-5">
					<input id="TGLHRMSMHS" name="TGLHRMSMHS" type="text" placeholder="TGL LAHIR" class="form-control input-md" value="<?= $v=(isset($value))? $value['TGLHRMSMHS'] : $validasi->value('TGLHRMSMHS');?>" >
					<?= $validasi->errorMessages('TGLHRMSMHS', '<span class="help-block">', '</span>');?>
					</div>
				</div>
				<!-- Text input-->
				<div class="form-group <?= $style ?>">
					<label class="col-md-4 control-label" for="data[KDJEKMSMHS]">JNS KEL</label>  
					<div class="col-md-5">
					<input id="KDJEKMSMHS" name="KDJEKMSMHS" type="text" placeholder="L / P" class="form-control input-md" value="<?=  $v=(isset($value))? $value['KDJEKMSMHS'] : $validasi->value('KDJEKMSMHS');?>" >
					<?= $validasi->errorMessages('KDJEKMSMHS', '<span class="help-block">', '</span>');?>
					</div>
				</div>

				<!-- Text input-->
				<div class="form-group <?= $style ?>">
					<label class="col-md-4 control-label" for="TAHUNMSMHS">TH MASUK</label>  
					<div class="col-md-5">
					<input id="TAHUNMSMHS" name="TAHUNMSMHS" type="text" placeholder="TTH MASUK" class="form-control input-md" value="<?= $v=(isset($value))? $value['TAHUNMSMHS'] : $validasi->value('TAHUNMSMHS');?>" >
					<?= $validasi->errorMessages('TAHUNMSMHS', '<span class="help-block">', '</span>');?>
					</div>
				</div>
				<!-- Button (Double) -->
				<div class="form-group">
				  <label class="col-md-4 control-label" for="submit"></label>
				  <div class="col-md-8">
					<button id="submit" name="submit" type="submit" class="btn btn-primary" name="datatables">Save</button>
					<button id="Cancel" name="Cancel" type="reset" class="btn btn-warning">Cancel</button>
				  </div>
				</div>

				</fieldset>
			</form>

			<?php
			var_dump((isset($validate))? $validate :"No Data");
			else:
			?>
				<div class="table-responsive">
					<table id="msmhs" class="table table-striped table-bordered table-hover table-condensed" id="dataTables-example">
						<thead>
							<tr>
									<th>NIM MHS</th>
									<th>NAMA MHS</th>
									<th>TMPT LAHIR</th>
									<th>TGL LAHIR</th>
									<th>JNS KEL</th>
									<th>TH MASUK</th>
								</tr>
								<tr>
									<th>NIM MHS</th>
									<th>NAMA MHS</th>
									<th>TMPT LAHIR</th>
									<th>TGL LAHIR</th>
									<th>JNS KEL</th>
									<th>TH MASUK</th>
							</tr>
						</thead>
					</table>
				</div>
				<!-- /.table-responsive -->
			<?php 
			endif;
			?>
		</div>
		<!-- /.col-lg-12 -->
	</div>
</div>
<script type="text/javascript">
	$(document).ready(function() {
	/*
		editor = new $.fn.dataTable.Editor( {
			"ajaxUrl": "<?php echo $this->location('Msmhs/init'); ?>",
			"domTable": "#msmhs",
			"fields": [ {
				}, {
					"label": "NIMHSMSMHS",
					"name": "NIMHSMSMHS"
				}, {
					"label": "NMMHSMSMHS",
					"name": "NMMHSMSMHS"
				}, {
					"label": "TPLHRMSMHS",
					"name": "TPLHRMSMHS"
				}, {
					"label": "TGLHRMSMHS",
					"name": "TGLHRMSMHS"
				}, {
					"label": "KDJEKMSMHS",
					"name": "KDJEKMSMHS"
				}, {
					"label": "TAHUNMSMHS",
					"name": "TAHUNMSMHS"
				}
			]
		} );
	 
		*/
		var editor = new $.fn.dataTable.Editor( {
			"ajaxUrl": "<?= $this->location('msmhs/init'); ?>",
			"domTable": "#msmhs"
		} );
				
		var oTable = $('#msmhs').dataTable( {
			"sAjaxSource": "<?= $this->location('msmhs/init'); ?>",
			"bProcessing": true,
			"bServerSide": true,
			"sServerMethod": "POST",
			"iDisplayLength": 50,
			"aLengthMenu": [[50, 100, 200, -1], [50, 100, 200, "All"]],
			"aoColumns": [
				{ "mDataProp": "NIMHSMSMHS","sWidth": "auto" },
				{ "mDataProp": "NMMHSMSMHS","sWidth": "auto" },
				{ "mDataProp": "TPLHRMSMHS","sWidth": "auto" },
				{ "mDataProp": "TGLHRMSMHS","sWidth": "auto" },
				{ "mDataProp": "KDJEKMSMHS","sWidth": "auto" },
				{ "mDataProp": "TAHUNMSMHS","sWidth": "auto" }

			],
			"oTableTools": {
				"sRowSelect": "multi",
				"sSwfPath": "<?php echo $this->uri->baseUri;?>assets/default/js/plugins/dataTables/copy_csv_xls_pdf.swf",
			/*
			"aButtons": [
					{ "sExtends": "editor_create", "editor": editor,"sButtonText":"New", },
				{ "sExtends": "editor_edit",   "editor": editor,"sButtonText":"Edit", },
				{ "sExtends": "editor_remove", "editor": editor,"sButtonText":"Delete", },
				{ "sExtends":
					"gotoURL",
					"sButtonText":"goto URL",
					"sGoToURL": "<?php echo $this->location('msmhs');?>",
					"fnClick": function( nButton, oConfig ) {
						if($(nButton).hasClass('disabled')) {
							return false;
						};
						var d = this.fnGetSelectedData();
						tabel_role(d[0].DT_RowId);
					}
				},
				"copy",
				"print",
				{
					"sExtends":    "collection",
					"sButtonText": 'Save <span class="caret" />',
					"aButtons":    [ "csv", "xls", "pdf" ]
				}
				]
			*/
				"aButtons": [
					{"sExtends":"gotoURL","sButtonText":"New","sGoToURL": "msmhs/add","fnInit":null,"fnSelect":null},	
					{"sExtends":"gotoURL","sButtonText":"Edit","sGoToURL": "msmhs/edit/","sParams":true},	
					{"sExtends":"editor_remove","editor": editor }
				]
			}
			
		}).columnFilter({
			sPlaceHolder: "head:after"
		});
	} );
</script>